package AdapterAndFacade.Facades;

import AdapterAndFacade.FacadeEntity.*;

/**
 * 使用组合使外观能访问子系统的所有组件
 * @Author: pengzx
 * @Description:
 * @Date: 17:08 2017/9/14
 * @Modified by: 1.0
 */
public class HomeTheaterFacade {
    Amplifier amplifier;
    CdPlayer cdPlayer;
    DvdPlayer dvdPlayer;
    PopcornPopper popper;
    Projector projector;
    Screen screen;
    TheaterLights theaterLights;
    Tuner tuner;

    public HomeTheaterFacade(Amplifier amplifier, CdPlayer cdPlayer, DvdPlayer dvdPlayer, PopcornPopper popper, Projector projector, Screen screen, TheaterLights theaterLights, Tuner tuner)
    {
        this.amplifier = amplifier;
        this.cdPlayer = cdPlayer;
        this.dvdPlayer = dvdPlayer;
        this.popper = popper;
        this.projector = projector;
        this.screen = screen;
        this.theaterLights = theaterLights;
        this.tuner = tuner;
    }

    //其他方法
    public void watchMovie(String movie){
        System.out.println("准备播放电影...");
        popper.on();
        popper.pop();
        theaterLights.dim(10);
        screen.down();
        projector.on();
        projector.wideSceenMode();
        amplifier.on();
        amplifier.setDvdPlayer(dvdPlayer);
        amplifier.setVolume(10);
        dvdPlayer.on();
        dvdPlayer.play(movie);
    }
}
